import i18n from '@/i18n/i18n'
export default {
  leads: 1,
  customer: 2,
  contacts: 3,
  product: 4,
  business: 5,
  contract: 6,
  receivables: 7,
  receivablesPlan: 8,
  pool: 9,
  visit: 17,
  invoice: 18,

  keyToTypeData: {
    leads: 1,
    customer: 2,
    contacts: 3,
    product: 4,
    business: 5,
    contract: 6,
    receivables: 7,
    receivablesPlan: 8,
    pool: 9,
    visit: 17,
    invoice: 18
  },

  typeToKeyData: {
    1: 'leads',
    2: 'customer',
    3: 'contacts',
    4: 'product',
    5: 'business',
    6: 'contract',
    7: 'receivables',
    8: 'receivablesPlan',
    9: 'pool',
    17: 'visit',
    18: 'invoice',
    21: 'leadsPool'
  },

  typeToNameData: {
    1: i18n.t('crm.model.6acaf77f424252a785a34448d8cec915'),
    2: i18n.t('crm.model.54ae73524b0c42ef8e255d51719a38db'),
    3: i18n.t('crm.model.6066eda0264300ff00a85c1a3fd7de70'),
    4: i18n.t('crm.model.ee32e419270b120404c2641c90c35bb6'),
    5: i18n.t('crm.model.d2ad9bb2dfebf85305de8cc8a5bf7f5a'),
    6: i18n.t('crm.model.c22e0a2a3d973cfcb759dcd3d4b322eb'),
    7: i18n.t('crm.model.cc26d009569ad2bc7ba549a038afa551'),
    8: i18n.t('crm.model.2df4b400e54f93f9983dc765d716f372'),
    9: i18n.t('crm.model.c2d56d00aa00affd87a0ef4886d8cac1'),
    17: i18n.t('crm.model.bb676ad1d1764c08b08581a44d171de3'),
    18: i18n.t('crm.model.0cb267b6968e3bb7ccc5de412c1af2cd'),
    21: '线索池'
  },

  keyToNameData: {
    leads: i18n.t('crm.model.1e6e28d26669c3fce88c8a6e11e12a71'),
    customer: i18n.t('crm.model.dadccd880affc64806c46c3fce36a9a2'),
    contacts: i18n.t('crm.model.70385a7eaa8cfaf8d96bc87537f815c9'),
    product: i18n.t('crm.model.efc06d5daf561b742af2c71f79e135bf'),
    business: i18n.t('crm.model.5ccf5db6987b735d523f355607827c3c'),
    contract: i18n.t('crm.model.b6976dde0e72dfcb9df77152d6ae405b'),
    receivables: i18n.t('crm.model.7515ffcc9e58d66bb285f9d5d53b51b4'),
    receivablesPlan: i18n.t('crm.model.5497869d2287d293fee4bfabb47d1177'),
    pool: i18n.t('crm.model.eee372352889c32efa3533b287f54512'),
    visit: i18n.t('crm.model.cf904fd281fdd441aed044c9dc951b0e'),
    invoice: i18n.t('crm.model.fce50dcf8adac8382cf3c86e98583764'),
    leadsPool: '线索池'
  },
  labelToType: {
    1: 'crmLeads',
    2: 'crmCustomer',
    3: 'crmContacts',
    4: 'crmProduct',
    5: 'crmBusiness',
    6: 'crmContract',
    7: 'crmReceivables',
    8: 'crmReceivablesPlan',
    9: 'crmPool',
    17: 'crmReturnVisit',
    18: 'crmInvoice',
    21: 'leadsPool'
  },

  convertKeyToType: function(key) {
    return this.keyToTypeData[key]
  },

  convertTypeToKey: function(type) {
    return this.typeToKeyData[type]
  },

  convertTypeToName: function(type) {
    if (typeof type === 'string') {
      type = parseInt(type)
    }
    return this.typeToNameData[type]
  },

  convertKeyToName: function(key) {
    return this.keyToNameData[key]
  }
}
